package jude.java.money.provide.impl;

import java.util.List;

import jude.java.money.beans.FtpSite;
import jude.java.money.provide.LimitedPagingProvider;
import jude.java.money.service.HeiService;
import jude.java.money.spring.Services;

public class ParasitizeProvider extends LimitedPagingProvider<FtpSite> {
	private HeiService heiService;
	
	public ParasitizeProvider(int limit) {
		super(limit);
		this.heiService = Services.getHeiService();
	}
	
	protected int getTotalCount2() {
		return heiService.countHeiFtpSite();
	}

//	@Override
//	public synchronized FtpSite get() {
//		FtpSite site = super.get();
//		if (site != null) {
//			System.out.println("\t***** " + site.getHost() + " *****");
//		} else {
//			System.out.println("\t***** null *****");
//		}
//		return site;
//	}

	@Override
	protected List<FtpSite> loadRecords2(int pageSize, int pageIndex) {
		return heiService.listHeiFtpSites(pageSize, pageIndex, isReverse());
	}
}
